<template>
  <a-modal
    class="fillmaskModal"
    title="切换任务"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
    wrapClassName="ant-modal-cust-warp"
    style="top: 5%; height: 85%; overflow-y: hidden"
  >
    <div class="info">
      <p v-if="selectionRows">当前任务：{{ selectionRows.taskName }}</p>
    </div>
    <a-spin :spinning="confirmLoading">
      <a-table
        style="height: 500px"
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{
          selectedRowKeys: selectedRowKeys1,
          onChange: onSelectChange1,
          type: 'radio',
        }"
        @change="handleTableChange"
      >
      </a-table>
    </a-spin>
  </a-modal>
</template>

<script>
import { ListMixin } from "@/mixins/ListMixin";
import {
  addRole,
  editRole,
  duplicateCheck,
  queryTasktListBuUserId,
} from "@/api/api";
import bus from "@/bus";
export default {
  name: "FillTaskList",
  mixins: [ListMixin],
  data() {
    return {
      value2: "",
      title: "操作",
      visible: false,
      selectedRowKeys1: [],
      roleDisabled: false,
      columns: [
        {
          title: "任务名称",
          align: "left",
          dataIndex: "taskName",
        },
       
        {
          title: "填报进度",
          dataIndex: "progress",
          align: "left",
        },
        {
          title: "创建日期",
          dataIndex: "createTime",
          align: "left",
        },
        {
          title: "任务描述",
          dataIndex: "description",
          align: "left",
        },
      ],
      selectionRows: null,
      layout: {
        labelCol: { span: 3 },
        wrapperCol: { span: 14 },
      },
      confirmLoading: false,
      url: {
        list: "/accounting/task/queryTaskListByUserId",
      },
    };
  },


  mounted() {},
  methods: {
    onSelectChange1(selectedRowKeys, selectionRows) {
      //   console.log(selectedRowKeys, selectionRows);
      this.selectedRowKeys1 = selectedRowKeys;
      this.selectionRows = selectionRows[0];
    },
    add() {
      this.edit(this.modelDefault);
    },
    edit(record) {
      this.model = Object.assign({}, record);
      this.visible = true;
      //编辑页面禁止修改角色编码
      if (this.model.id) {
        this.roleDisabled = true;
      } else {
        this.roleDisabled = false;
      }
    },
    close() {
      //   this.$refs.form.clearValidate();
      this.$emit("close");
      this.visible = false;
    },
    handleOk() {
      //   console.log(this.selectionRows)
      bus.$emit("changeTask", this.selectionRows);
      this.close();
    },
    handleCancel() {
      this.close();
    }
  },
};
</script>

<style lang="scss" scoped>
@import "@/assets/css/newrModule.scss";
.fillmaskModal .ant-modal-body {
  padding-top: 0px !important;
  padding-left: 0;
  padding-right: 0;
}
.fillmaskModal .ant-spin-nested-loading {
  padding: 12px 24px !important;
}
.fillmaskModal .ant-select-selection-selected-value {
  font-size: 12px;
}
.fillmaskModal .info {
  background: #ebf5fe;

  background-image: linear-gradient(
    rgb(209, 231, 253),
    rgba(245, 249, 253, 0.644)
  );
  padding: 12px 24px !important;
  margin-bottom: 10px;
  //   border-bottom: 1px dashed rgb(241, 241, 241);
  p {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    margin-bottom: 4px;
  }
}
</style>